<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>
<body>
<center>
    <div id="app">
        <input type="text" v-model="num">
        <br>
        <h4>{{num}}</h4>
        <hr>
        <h1>{{value}}</h1>
        <h1>{{value}}</h1>
    </div>
</center>
</body>

<script type="text/javascript">
    // 实例化vue对象
    let vm = new Vue({
        el: "#app",
        data: {
            num: 0
        },
        // 计算属性
        computed: {
            value(){
                return this.num * this.num;
            }
        }
    });
</script>
</html>